Skip to content

Instantly share code, notes, and snippets.

@idcrook
Last active July 1, 2020 18:29
Show Gist options
  • Save idcrook/1eef0fa371d356a3791ebc5f7ea2598b to your computer and use it in GitHub Desktop.
Save idcrook/1eef0fa371d356a3791ebc5f7ea2598b to your computer and use it in GitHub Desktop.

Revisions

  1. [REDACTED] revised this gist Jul 1, 2020. 3 changed files with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions app_icon_model.scad
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,9 @@
    // Reverse-engineer model an Xcode 12 Instruments icon mesh in OpenSCAD
    // [email protected]

    // Inspired to create by
    // https://twitter.com/edwardsanchez/status/1278152030645698560

    // Turn on Animate in App menu bar
    // [x] Check Dump Pictures
    // - creates files in sequence frame00000.png
    Binary file added z_app_icon_model_25pct.png
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
    Binary file added zz_animated_25pct.gif
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
  2. idcrook revised this gist Jul 1, 2020. No changes.
  3. idcrook created this gist Jul 1, 2020.
    75 changes: 75 additions & 0 deletions app_icon_model.scad
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,75 @@
    // Reverse-engineer model an Xcode 12 Instruments icon mesh in OpenSCAD
    // [email protected]

    // Turn on Animate in App menu bar
    // [x] Check Dump Pictures
    // - creates files in sequence frame00000.png
    // - Select FPS: 12 and Steps: 60
    //
    // Time ($t) sweeps from 0.0 to 1.0

    size = 100;

    // https://openscadsnippetpad.blogspot.com/2017/06/figure-eight-path.html

    function figure8(m=size)=[for(t=[0:1:360])
    let(scale = 2 / (3 - cos(2*t)),x =m* scale * cos(t),y =m* scale * sin(2*t) / 2)
    [x,y]];

    function close(p)= concat(p,[p[0]]);

    module polyline(p) {for(i=[0:max(0,len(p)-2)])line(p[i],p[i+1]);}
    module line(p1, p2, width=(size/7)/2.0)
    {
    hull() {
    translate(p1) sphere(width);
    translate(p2) sphere(width);
    }
    }

    module one_symbol() {
    polyline(close(figure8(size/2)));
    }

    module assembly2 () {
    x_off = 16.5;
    z_off = 23;

    translate([-x_off,0,0])
    //rotate([45/2 , 90 + 30, 45/2])
    rotate([0 , 90 + 30, 0])
    rotate([0 , 0, -15])
    one_symbol();

    translate([x_off,0,0])
    rotate([0, -(90 + 30), 0])
    rotate([0 , 0, -15])
    one_symbol();

    translate([0,0,-z_off])
    rotate([0 , 0, -15])
    rotate([0 , 0, 0])
    one_symbol();
    }

    show_assembly = true;

    // $preview requires version 2019.05
    fn = $preview ? 30 : 100;

    // can only _assign_ viewpoint variables at top-level
    $vpt = [0,0,0];
    $vpr = [90, 0, $t * 360]; // rotate viewpoint
    $vpd = 415;

    if (show_assembly) {
    scale ([1.0,1.0,1.0])
    translate([0,0,0])
    rotate([0,0,0])
    assembly2();
    } else {
    scale ([1.0,1.0,1.0])
    translate([0,0,0])
    rotate([0,0,0])
    one_symbol();
    }
    7 changes: 7 additions & 0 deletions convert_to_gif.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    #!/bin/bash -x

    # ImageMagick has these utilities

    convert 'frame000*.png' -set delay 1x24 animated.gif

    convert animated.gif -scale 25% animated_25pct.gif