void HandleEffect1TlNewFrame(object o, NewFrameArgs args) { vtexture.SetRotation(RotateAxis.YAxis, (float)args.FrameNum * 12, (int)Stage.Default.Width / 2, 0, 0); }
private void OnCellSelectTimelineNewFrame(object o, NewFrameArgs args) { if (visible_actor_count <= 0 || visible_grid_width <= 0) { return; } int target_x = 0, target_y = 0; Clone cell_target = null; while (cell_target == null) { int index = random.Next(0, visible_actor_count); target_x = index % visible_grid_width; target_y = index / visible_grid_width; cell_target = grid[target_x, target_y]; if (waiting_for_slot.Contains(cell_target) || history_slots.Contains(cell_target)) { cell_target = null; } } var cell_source = new Clone(GetRandomActor()) { Visible = true, Parent = this }; cell_source.Allocate(new ActorBox() { X1 = target_x * 100, Y1 = target_y * 100, X2 = target_x * 100 + 100, Y2 = target_y * 100 + 100 }, AllocationFlags.DelegateLayout); waiting_for_slot.Insert(0, cell_source); history_slots.Enqueue(cell_source); if (history_slots.Count > 5) { history_slots.Dequeue(); } cell_target.AnimationChain .SetEasing(AnimationMode.EaseInQuad) .SetDuration((uint)random.Next(300, 1500)) .WhenFinished((a) => { grid[target_x, target_y] = cell_source; waiting_for_slot.Remove(cell_source); QueueRedraw(); }) .Animate("opacity", 0); }
static void HandleNewFrame(object o, NewFrameArgs args) { CurrentOH.Group.SetRotation (RotateAxis.Z, args.FrameNum, (int)Stage.Default.Width / 2, (int)Stage.Default.Height / 2, 0); foreach (Actor hand in CurrentOH.Hands) { hand.SetRotation (RotateAxis.Z, -6.0F * args.FrameNum, (int)hand.Width / 2, (int)hand.Height / 2, 0); } }
static void HandleNewFrame(object o, NewFrameArgs args) { CurrentOH.Group.SetRotation(RotateAxis.ZAxis, args.FrameNum, (int)Stage.Default.Width / 2, (int)Stage.Default.Height / 2, 0); foreach (Actor hand in CurrentOH.Hands) { hand.SetRotation(RotateAxis.ZAxis, -6.0F * args.FrameNum, (int)hand.Width / 2, (int)hand.Height / 2, 0); } }
void HandleControlTlNewFrame(object o, NewFrameArgs args) { control.ShowAll(); if (paused) { control_pause.Hide(); control_play.Show(); } else { control_play.Hide(); control_pause.Show(); } uint opacity = (uint)((args.FrameNum * 0xde) / controls_tl.NumFrames); if (!controls_showing) { opacity = 0xde - opacity; } control.Opacity = (byte)opacity; }
static unsafe void OnNewFrame(object o, NewFrameArgs args) { Color color = Color.Zero; uint n_frames = timeline.FrameCount; int frame_num = args.FrameNum; float period_progress = ((float)frame_num / (float)n_frames) * 2.0f * (float)Math.PI; float period_progress_sin = (float)Math.Sin (period_progress); float wave_shift = period_progress * WAVE_SPEED; float ripple_shift = period_progress * RIPPLE_SPEED; for (uint y = 0; y <= MESH_HEIGHT; y++) { for (uint x = 0; x <= MESH_WIDTH; x++) { uint vert_index = (MESH_WIDTH + 1) * y + x; float *vert = &quad_mesh_verts[3 * vert_index]; float real_x = x * QUAD_WIDTH; float real_y = y * QUAD_HEIGHT; float wave_offset = (float)x / (MESH_WIDTH + 1); float wave_angle = (WAVE_PERIODS * 2 * (float)Math.PI * wave_offset) + wave_shift; float wave_sin = (float)Math.Sin (wave_angle); float a_sqr = (RIPPLE_CENTER_X - real_x) * (RIPPLE_CENTER_X - real_x); float b_sqr = (RIPPLE_CENTER_Y - real_y) * (RIPPLE_CENTER_Y - real_y); float ripple_offset = (float)Math.Sqrt (a_sqr + b_sqr) / RIPPLE_RADIUS; float ripple_angle = (RIPPLE_PERIODS * 2 * (float)Math.PI * ripple_offset) + ripple_shift; float ripple_sin = (float)Math.Sin (ripple_angle); vert[2] = (wave_sin * WAVE_DEPTH) + (ripple_sin * RIPPLE_DEPTH); // Burn some CPU time picking a pretty color... float h = (HSL_OFFSET + wave_sin + ripple_sin + period_progress_sin) * HSL_SCALE; float s = 0.5f; float l = 0.25f + (period_progress_sin + 1.0f) / 4.0f; color.FromHls (h * 360.0f, l, s); byte *c = &quad_mesh_colors[4 * vert_index]; c[0] = color.R; c[1] = color.G; c[2] = color.B; } } Cogl.VertexBuffer.Add (buffer, "gl_Vertex", 3, // n components Cogl.GL.GL_FLOAT, false, // normalized 0, // stride new IntPtr (quad_mesh_verts)); Cogl.VertexBuffer.Add (buffer, "gl_Color", 4, // n components Cogl.GL.GL_UNSIGNED_BYTE, false, // normalized 0, // stride new IntPtr (quad_mesh_colors)); Cogl.VertexBuffer.Submit (buffer); dummy.SetRotation (RotateAxis.Z, frame_num, (int)((MESH_WIDTH * QUAD_WIDTH) / 2), (int)((MESH_HEIGHT * QUAD_HEIGHT) / 2), 0); dummy.SetRotation (RotateAxis.X, frame_num, (int)((MESH_WIDTH * QUAD_WIDTH) / 2), (int)((MESH_HEIGHT * QUAD_HEIGHT) / 2), 0); }
/// <summary> /// Should call this function each time a new Frame had been /// treated inside a AssimpConverted implementation class /// </summary> /// <param name="e"></param> protected void OnFrame(NewFrameArgs e) { EventHandler<NewFrameArgs> handler = NewFrame; if (handler != null) { handler(this, e); } }
void HandleEffect1TlNewFrame(object o, NewFrameArgs args) { vtexture.SetRotation (RotateAxis.YAxis, (float)args.FrameNum * 12, (int)Stage.Default.Width / 2, 0, 0); }
void HandleControlTlNewFrame(object o, NewFrameArgs args) { control.ShowAll (); if (paused) { control_pause.Hide (); control_play.Show (); } else { control_play.Hide (); control_pause.Show (); } uint opacity = (uint)((args.FrameNum * 0xde) / controls_tl.NumFrames); if (!controls_showing) opacity = 0xde - opacity; control.Opacity = (byte)opacity; }
static unsafe void OnNewFrame(object o, NewFrameArgs args) { Color color = Color.Zero; uint n_frames = timeline.FrameCount; int frame_num = args.FrameNum; float period_progress = ((float)frame_num / (float)n_frames) * 2.0f * (float)Math.PI; float period_progress_sin = (float)Math.Sin(period_progress); float wave_shift = period_progress * WAVE_SPEED; float ripple_shift = period_progress * RIPPLE_SPEED; for (uint y = 0; y <= MESH_HEIGHT; y++) { for (uint x = 0; x <= MESH_WIDTH; x++) { uint vert_index = (MESH_WIDTH + 1) * y + x; float *vert = &quad_mesh_verts[3 * vert_index]; float real_x = x * QUAD_WIDTH; float real_y = y * QUAD_HEIGHT; float wave_offset = (float)x / (MESH_WIDTH + 1); float wave_angle = (WAVE_PERIODS * 2 * (float)Math.PI * wave_offset) + wave_shift; float wave_sin = (float)Math.Sin(wave_angle); float a_sqr = (RIPPLE_CENTER_X - real_x) * (RIPPLE_CENTER_X - real_x); float b_sqr = (RIPPLE_CENTER_Y - real_y) * (RIPPLE_CENTER_Y - real_y); float ripple_offset = (float)Math.Sqrt(a_sqr + b_sqr) / RIPPLE_RADIUS; float ripple_angle = (RIPPLE_PERIODS * 2 * (float)Math.PI * ripple_offset) + ripple_shift; float ripple_sin = (float)Math.Sin(ripple_angle); vert[2] = (wave_sin * WAVE_DEPTH) + (ripple_sin * RIPPLE_DEPTH); // Burn some CPU time picking a pretty color... float h = (HSL_OFFSET + wave_sin + ripple_sin + period_progress_sin) * HSL_SCALE; float s = 0.5f; float l = 0.25f + (period_progress_sin + 1.0f) / 4.0f; color.FromHls(h * 360.0f, l, s); byte *c = &quad_mesh_colors[4 * vert_index]; c[0] = color.R; c[1] = color.G; c[2] = color.B; } } Cogl.VertexBuffer.Add(buffer, "gl_Vertex", 3, // n components Cogl.GL.GL_FLOAT, false, // normalized 0, // stride new IntPtr(quad_mesh_verts)); Cogl.VertexBuffer.Add(buffer, "gl_Color", 4, // n components Cogl.GL.GL_UNSIGNED_BYTE, false, // normalized 0, // stride new IntPtr(quad_mesh_colors)); Cogl.VertexBuffer.Submit(buffer); dummy.SetRotation(RotateAxis.Z, frame_num, (int)((MESH_WIDTH * QUAD_WIDTH) / 2), (int)((MESH_HEIGHT * QUAD_HEIGHT) / 2), 0); dummy.SetRotation(RotateAxis.X, frame_num, (int)((MESH_WIDTH * QUAD_WIDTH) / 2), (int)((MESH_HEIGHT * QUAD_HEIGHT) / 2), 0); }