Skip to content

Instantly share code, notes, and snippets.

View GrantMeStrength's full-sized avatar
💭
I came here to drink milk and write code.. and I've just finished my milk.

John Kennedy GrantMeStrength

💭
I came here to drink milk and write code.. and I've just finished my milk.
View GitHub Profile
@GrantMeStrength
GrantMeStrength / WindowsCompositionAnimationExample.md
Created December 28, 2018 22:31
Using Windows 10 Composition Animations

The new Composition Animation effects available in Windows 10 make it easy to create simple animation effects for XAML controls. For example, here's a simple example that applies a scaling effect to a Button when the user's mouse pointer moves over it.

Here's the XAML:

<Page
    x:Class="UWP_Animation.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@GrantMeStrength
GrantMeStrength / line.swift
Last active March 17, 2024 12:19
Drawing a line between two points in SceneKit / iOS / Swift
func line(from p1: SCNVector3, to p2: SCNVector3) -> SCNNode? {
// Draw a line between two points and return it as a node
var indices = [Int32(0), Int32(1)]
let positions = [p1, p2]
let vertexSource = SCNGeometrySource(vertices: positions)
let indexData = Data(bytes: &indices, count:MemoryLayout<Int32>.size * indices.count)
let element = SCNGeometryElement(data: indexData, primitiveType: .line, primitiveCount: 1, bytesPerIndex: MemoryLayout<Int32>.size)
let line = SCNGeometry(sources: [vertexSource], elements: [element])
let lineNode = SCNNode(geometry: line)