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

New scene graph model #2863

Merged
merged 52 commits into from
Jan 6, 2025
Merged

New scene graph model #2863

merged 52 commits into from
Jan 6, 2025

Conversation

wcandillon
Copy link
Contributor

This is a new model where use a Picture recorder that supports animation values.
Consider the following deeply nested tree:

<Image x={0} y={0} width={width} height={height} image={oslo} fit="cover">
  <ColorMatrix matrix={matrix} />
  <LinearToSRGBGamma>
    <Lerp t={t}>
      <ColorMatrix matrix={purple} />
      <ColorMatrix matrix={blackAndWhite} />
    </Lerp>
  </LinearToSRGBGamma>
</Image>

This will generate the following instruction set:

[
  { type: 'SaveCTM', props: { transform: [Array] } },
  { type: 'SavePaint', props: {} },
  {
    type: 'PushColorFilter',
    colorFilterType: 'skMatrixColorFilter',
    props: { matrix: [Array] }
  },
  {
    type: 'PushColorFilter',
    colorFilterType: 'skMatrixColorFilter',
    props: { matrix: [Array] }
  },
  {
    type: 'PushColorFilter',
    colorFilterType: 'skMatrixColorFilter',
    props: { matrix: [Array] }
  },
  {
    type: 'PushColorFilter',
    colorFilterType: 'skLerpColorFilter',
    props: { t: 0.5 }
  },
  {
    type: 'PushColorFilter',
    colorFilterType: 'skLinearToSRGBGammaColorFilter',
    props: {}
  },
  { type: 'ComposeColorFilter' },
  { type: 'MaterializePaint' },
  {
    type: 'DrawImage',
    props: {
      x: 0,
      y: 0,
      width: 256,
      height: 256,
      image: [JsiSkImage],
      fit: 'cover'
    }
  },
  { type: 'RestorePaint' },
  { type: 'RestoreCTM' }
]

@wcandillon wcandillon merged commit fef5aba into Shopify:main Jan 6, 2025
8 checks passed
Copy link
Contributor

github-actions bot commented Jan 6, 2025

🎉 This PR is included in version 1.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

1 participant