<commit_before>module Page.Lissajous exposing (..)

import AnimationFrame
import Collage exposing (Form, LineStyle, Path, circle, collage, defaultLine, filled, group, move, moveY, oval, path, rect, rotate, segment, traced)
import Color exposing (Color, darkPurple, green, lightGrey, red, rgb)
import ColorPicker
import Element exposing (container, middle, toHtml)
import FormatNumber exposing (format)
import FormatNumber.Locales exposing (Locale, usLocale)
import Html exposing (Html, a, br, button, code, div, form, h2, h3, hr, i, img, input, label, li, p, span, text, u, ul)
import Html.Attributes exposing (alt, attribute, class, href, id, max, min, name, size, src, step, style, type_, value)
import Html.Events exposing (defaultOptions, onClick, onInput, onWithOptions)
import Json.Decode exposing (succeed)
import List exposing (append, concatMap, drop, length, map, range, sum)
import Markdown
import Maybe exposing (andThen, withDefault)
import Page.Common exposing (asCss, strToFloatWithMinMax, strToIntWithMinMax)
import Result exposing (toMaybe)
import Round
import String exposing (padLeft)
import String.Interpolate exposing (interpolate)
import Text exposing (color, fromString, monospace)
import Time exposing (Time)



-- PAGE INFO

info : Page.Common.PageInfo Msg
info = {
     name = "lissajous"
     , hash = "lissajous"
     , description = Markdown.toHtml [class "info"] """
Animated [Lissajous figures](https://en.wikipedia.org/wiki/Lissajouss_curve).

This demo allows to visualize Lissajous curves in motion and adjust some parameters in real-time.


       """
     , srcRel = "Page/Lissajous.elm"
 }

-- MODEL

type alias Model = {
    -- parameter a for the lissajous curve
     a : Int
    -- parameter b for the lissajous curve
    ,b : Int
    -- phase for the lissajous curve (in degrees, more simpler for humans)
    ,p: Float
    -- velocity of the phase in turns (2*pi) per minutes
    ,vp: Float
    -- if animation is started or not
    ,started: Bool
    -- style for the curve
    ,curveStyle : LineStyle
    -- resolution of the line - i.e. total number of points to draw the curve (1 period), more is best
    ,resolution : Int
    -- a list containing n last ticks, used to compute the fps (frame per seconds)
    ,ticks : Ticks
    ,foregroundColorPicker : ColorPicker.State
  }

initialModel : Model
initialModel = {
      a = 3
     ,b = 4
     ,p = 90 -- π/2
     ,vp = 1
     ,started = False
     ,curveStyle = { defaultLine | width = 2, color = rgb 31 122 31 }
     ,resolution = 500
     ,ticks = createTicks 100 -- initial capacity
     ,foregroundColorPicker = ColorPicker.empty
  }

initialCmd : Cmd Msg
initialCmd = Cmd.none

-- UPDATE<commit_msg>:lipstick: the animation is now started by default<commit_after>module Page.Lissajous exposing (..)

import AnimationFrame
import Collage exposing (Form, LineStyle, Path, circle, collage, defaultLine, filled, group, move, moveY, oval, path, rect, rotate, segment, traced)
import Color exposing (Color, darkPurple, green, lightGrey, red, rgb)
import ColorPicker
import Element exposing (container, middle, toHtml)
import FormatNumber exposing (format)
import FormatNumber.Locales exposing (Locale, usLocale)
import Html exposing (Html, a, br, button, code, div, form, h2, h3, hr, i, img, input, label, li, p, span, text, u, ul)
import Html.Attributes exposing (alt, attribute, class, href, id, max, min, name, size, src, step, style, type_, value)
import Html.Events exposing (defaultOptions, onClick, onInput, onWithOptions)
import Json.Decode exposing (succeed)
import List exposing (append, concatMap, drop, length, map, range, sum)
import Markdown
import Maybe exposing (andThen, withDefault)
import Page.Common exposing (asCss, strToFloatWithMinMax, strToIntWithMinMax)
import Result exposing (toMaybe)
import Round
import String exposing (padLeft)
import String.Interpolate exposing (interpolate)
import Text exposing (color, fromString, monospace)
import Time exposing (Time)



-- PAGE INFO

info : Page.Common.PageInfo Msg
info = {
     name = "lissajous"
     , hash = "lissajous"
     , description = Markdown.toHtml [class "info"] """
Animated [Lissajous figures](https://en.wikipedia.org/wiki/Lissajouss_curve).

This demo allows to visualize Lissajous curves in motion and adjust some parameters in real-time.


       """
     , srcRel = "Page/Lissajous.elm"
 }

-- MODEL

type alias Model = {
    -- parameter a for the lissajous curve
     a : Int
    -- parameter b for the lissajous curve
    ,b : Int
    -- phase for the lissajous curve (in degrees, more simpler for humans)
    ,p: Float
    -- velocity of the phase in turns (2*pi) per minutes
    ,vp: Float
    -- if animation is started or not
    ,started: Bool
    -- style for the curve
    ,curveStyle : LineStyle
    -- resolution of the line - i.e. total number of points to draw the curve (1 period), more is best
    ,resolution : Int
    -- a list containing n last ticks, used to compute the fps (frame per seconds)
    ,ticks : Ticks
    ,foregroundColorPicker : ColorPicker.State
  }

initialModel : Model
initialModel = {
      a = 3
     ,b = 4
     ,p = 90 -- π/2
     ,vp = 1
     ,started = True
     ,curveStyle = { defaultLine | width = 2, color = rgb 31 122 31 }
     ,resolution = 500
     ,ticks = createTicks 100 -- initial capacity
     ,foregroundColorPicker = ColorPicker.empty
  }

initialCmd : Cmd Msg
initialCmd = Cmd.none

-- UPDATE
{'fraction_non_alphanumeric': 0.0948878264067672, 'fraction_numerical': 0.008826774549466716, 'mean_word_length': 3.59375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4410047', 'n_tokens_mistral': 1747, 'n_tokens_neox': 1615, 'n_words': 638}