Skip to content

Commit

Permalink
Example webgpu_tsl_editor: Simple uv.x animation (#26368)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunag committed Jul 4, 2023
1 parent 8832496 commit 775ff28
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions examples/webgpu_tsl_editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,21 @@
const editorDOM = document.getElementById( 'source' );
const resultDOM = document.getElementById( 'result' );

const tslCode = `// Simple example
const tslCode = `// Simple uv.x animation
const { texture, uniform, vec4 } = TSL;
const { texture, uniform, vec2, vec4, uv, oscSine, timerLocal } = TSL;
//const samplerTexture = new THREE.Texture();
const samplerTexture = new THREE.TextureLoader().load( './textures/uv_grid_opengl.jpg' );
samplerTexture.wrapS = THREE.RepeatWrapping;
//samplerTexture.wrapT = THREE.RepeatWrapping;
const timer = timerLocal( .5 ); // .5 is speed
const uv0 = uv();
const animateUv = vec2( uv0.x.add( oscSine( timer ) ), uv0.y );
// label is optional
const myMap = texture( samplerTexture ).rgb.label( 'myTexture' );
const myMap = texture( samplerTexture, animateUv ).rgb.label( 'myTexture' );
const myColor = uniform( new THREE.Color( 0x0066ff ) ).label( 'myColor' );
const opacity = .7;
Expand Down

0 comments on commit 775ff28

Please sign in to comment.