Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor scintillator… #412

Open
dtinth opened this issue Oct 24, 2016 · 1 comment
Open

Refactor scintillator… #412

dtinth opened this issue Oct 24, 2016 · 1 comment

Comments

@dtinth
Copy link
Member

dtinth commented Oct 24, 2016

This will probably happen after we migrate to PIXI v4.

Scope:

  • Change file format from XML to JavaScript.
  • Everything else, the same!
<skin width="123" height="456">
  <group y="t*2">
    <animation>
      <keyframe t="0" x="10" />
      <keyframe t="1" x="20" />
    </animation>
    <animation on="exitEvent">
      <keyframe t="0" x="50" y="0" />
      <keyframe t="1" x="70" y="100" />
    </animation>
  </group>
</skin>
export const skin = Skin({ width: 123, height: 456 }, [
  Group({
    y: 't*2',
    animations: {
      default: [
        { t: 0, x: 10 },
        { t: 1, x: 20 }
      ],
      exitEvent: [
        { t: 0, x: 50, y: 0 },
        { t: 1, x: 70, y: 100 }
      ]
    }
  }, [
  ])
])
@dtinth
Copy link
Member Author

dtinth commented Dec 8, 2016

This makes it quite hard to add conditionals to code.

Let’s use an imperative builder instead.

export default (builder) => {
  const { skin, group, animation, keyframe } = builder
  skin({ width: 123, height: 456 }, () => {
    group({ y: 't * 2' }, () => {
      animation(() => {
        keyframe({ t: 0, x: 10 })
        keyframe({ t: 1, x: 20 })
      })
      animation('exitEvent', () => {
        keyframe({ t: 0, x: 50, y: 0 })
        keyframe({ t: 1, x: 70, y: 100 })
      })
    })
  })
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant