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 #2862

Closed
wants to merge 27 commits into from
Closed

New scene graph model #2862

wants to merge 27 commits into from

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 closed this Jan 6, 2025
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

Successfully merging this pull request may close these issues.

1 participant