Skip to content

Instantly share code, notes, and snippets.

View leochocolat's full-sized avatar
🎯
Focusing

Léo Mouraire leochocolat

🎯
Focusing
View GitHub Profile
@leochocolat
leochocolat / fragment.glsl
Created November 7, 2022 19:35
three-msdf-text - shader without chunks
// Varyings
varying vec2 vUv;
// Uniforms: Common
uniform float uOpacity;
uniform float uThreshold;
uniform float uAlphaTest;
uniform vec3 uColor;
uniform sampler2D uMap;
@leochocolat
leochocolat / BlobComponent.js
Created September 22, 2021 16:06
Canvas 2d Blob
import bindAll from "../utils/bindAll";
import { gsap } from 'gsap';
import ResizeManager from '../managers/ResizeManager';
import SimplexNoise from 'simplex-noise';
const COLOR = '#979797';
const RADIUS_FACTOR = 0.45;
const CENTER_FACTOR_X = 0.70;
const CENTER_FACTOR_Y = 0.25;
const NOISE_SCALE = 60;
// Vendors
import gsap from 'gsap';
import InertiaPlugin from '@/vendor/gsap/InertiaPlugin';
import SplitText from '@/vendor/gsap/SplitText';
// Utils
import lerp from '@/utils/math/lerp';
import device from '@/utils/device';
import WindowResizeObserver from '@/utils/WindowResizeObserver';
<template>
<div class="slide">
slide
</div>
</template>
<script>
export default {
methods: {
transitionIn() {
<template>
<div class="slider">
<Slide v-for="(item, index) in items" v-bind:key="index" ref="slide" />
</div>
</template>
<script>
import Slider from '@/components/Slide';
export default {
import Flickity from 'flickity'
import { TweenLite, Power4, TimelineLite } from 'gsap';
import mod from '../utils/mod';
class MissionsSlider {
constructor(el) {
this.el = el
this.dom()
}
setupScrollParagraph() {
let scrollParagraph = this.$el.querySelector('.js-scroll-paragraph');
let originalContent = scrollParagraph.innerHTML;
let splits = new SplitText(scrollParagraph, {
type: 'lines',
linesClass: 'line-container line-container--++',
});
let lines = [];
#define numTextures 7
#define THRESHOLD 0.2
uniform vec3 iResolution;
uniform float iTime;
uniform float iTimeDelta;
uniform float iFrame;
uniform sampler2D u_texture;
// uniform sampler2D u_textures;
<template>
<canvas class="three-canvas"></canvas>
</template>
<script>
import ThreeCanvasComponent from '~/assets/javascript/components/ThreeCanvasComponent';
export default {
props: {
_tick() {
this._updateDeltaTime();
this._cylinderMesh.rotation.z += 0.005;
this._cylinderMesh.rotation.x += 0.005;
// this._cylinderMesh.rotation.z += 0.03;
// this._cylinderMesh.rotation.x += 0.03;
this._uniforms.iChannel1.value = this._renderTarget.texture;
this._renderer.setRenderTarget(this._renderTarget);
this._renderer.render(this._scene, this._camera);