import * as THREE from "three"; import {OrbitControls} from "three/examples/jsm/controls/OrbitControls.js"; // Canvas const canvas = document.querySelector("canvas.webgl"); // Scene const scene = new THREE.Scene(); /** * Particles */ const particlesGeometry = new THREE.PlaneGeometry(3, 3, 20, 20); particlesGeometry.rotateX(-Math.PI / 2.2); // Vertex shader code const vertexShader = ` uniform float size; uniform float time; uniform float amplitude; uniform float frequency; uniform float phaseOffset; void main() { // Calculate the displacement based on time and position float wavePhase = position.x * frequency + time + phaseOffset; vec3 newPosition = position + vec3(0.0, sin(position.x * 2.0 + time) * amplitude, 0.0); // Transform the vertex position as usual vec4 mvPosition = modelViewMatrix * vec4( newPosition, 1.0 ); gl_PointSize = size * ( 300.0 / -mvPosition.z ); gl_Position = projectionMatrix * mvPosition; } `; // Fragment shader code const fragmentShader = ` uniform vec3 color; void main() { gl_FragColor = vec4( color, 1.0 ); float dist = distance(gl_PointCoord, vec2(0.5, 0.5)); if (dist > 0.5) discard; } `; const particlesMaterial = new THREE.ShaderMaterial({ uniforms: { size: {value: 0.04}, // Pink color: {value: new THREE.Color(0.886, 0.176, 0.431)}, time: {value: 0}, amplitude: {value: 0.3}, }, vertexShader: vertexShader, fragmentShader: fragmentShader, transparent: true, }); const particles = new THREE.Points(particlesGeometry, particlesMaterial); scene.add(particles); /** * Sizes */ const sizes = { width: window.innerWidth, height: window.innerHeight, }; window.addEventListener("resize", function () { // Update sizes sizes.width = window.innerWidth; sizes.height = window.innerHeight; // Update camera camera.aspect = sizes.width / sizes.height; camera.updateProjectionMatrix(); // Update renderer renderer.setSize(sizes.width, sizes.height); renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); }); /** * Camera */ // Base camera const camera = new THREE.PerspectiveCamera( 75, sizes.width / sizes.height, 0.1, 100 ); camera.position.z = 3; scene.add(camera); // Controls const controls = new OrbitControls(camera, canvas); controls.enableDamping = true; /** * Renderer */ const renderer = new THREE.WebGLRenderer({ canvas: canvas, alpha: true, }); renderer.setSize(sizes.width, sizes.height); renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); /** * Animate */ const clock = new THREE.Clock(); const cameraMovementSpeed = 0.09; const cameraZOffset = 1.5; const tick = function () { const elapsedTime = clock.getElapsedTime(); // Update controls controls.update(); // Move the camera back and forth camera.position.x = Math.sin(elapsedTime * cameraMovementSpeed) * 1; // Adjust the amplitude as per your scene camera.position.z = cameraZOffset; // Look at the center of the scene camera.lookAt(scene.position); particlesMaterial.uniforms.time.value = elapsedTime; // Render renderer.render(scene, camera); // Call tick again on the next frame window.requestAnimationFrame(tick); }; tick();
Every day, extraordinary women are making waves in the pursuit of global gender equalitry and social change that benefits us all. Each week, Women's Voices Now features the women who are making those waves around the world. We aim to inspire our audicences through these stories and to let those women making waves know that we are watching and following their example!
5 Things You Need to Know About Protests Prompted by Mahsa Aminis Death Slide 1 (source_ Ozan Köse_AFP_Getty Images)

5 Things You Need to Know About Protests Prompted by Mahsa Amini’s Death

Mahsa Amini's Death: What You Need To Know. 22-year-old Mahsa Amini was arrested in Tehran for "improperly" wearing her hijab. She died in police custody on September 16th, 2022.By Erin Pedersen What happened? 22-year-old Mahsa AminiRead More »
Women Making Waves - afghan women Blog Post - Womens Voices Now 4 - women in the media

Afghan Women Making Waves

Afghan Women Making Waves. It's been one year since the Taliban gained control of Afghanistan. Their presence has affected women's rights in many ways. Forcing them to take desperate measures to survive. Learn more about women inRead More »
Martha Koome Appointed as Kenya's First Female Supreme Court Chief Justice - 1 (Source_ Getty Images)

Martha Koome Appointed as Kenya’s First Female Supreme Court Chief Justice

Martha Koome: Kenya's First Female Supreme Court Chief Justice. In August 2022, Martha Koome was given the role of Kenya's most senior judge for the presidential election. She is the first woman to be appointed asRead More »
1 2 3 4

2024 Girls Voices Now Summer Media Training Program applications are now open