evancz / elm-playground

Create pictures, animations, and games with Elm!
https://package.elm-lang.org/packages/evancz/elm-playground/latest/
BSD 3-Clause "New" or "Revised" License
107 stars 17 forks source link

transform order ignored #23

Open Vekkq opened 3 years ago

Vekkq commented 3 years ago

Hi! I noticed, that the transformation order is ignored and always defaulting to the order translate-rotate-scale. But transformations are not commutative, leading to different results depending on order, so they should not be sorted.

Example:

module Main exposing (..)
import Playground exposing (..)

main = animation view

view t = [ball t, ball2 t, ball3 t]

ball  t =        circle green 6 |> rotate (spin 3 t) |> moveRight 40
ball2 t =        circle red 6   |> moveRight 40      |> rotate (spin 3 t)
ball3 t = group [circle blue 6  |> moveRight 40]     |> rotate (spin 3 t)

-- Ball 2 is supposed to work like ball 3,
--  but is behaving like ball 1, covering the same place.
-- Ball 3 is a workaround using groups.