Coder Social home page Coder Social logo

aesor's Introduction

aesor - Library to draw skeuomorphic UI assets

Examples

slider

Show code
let setting = Setting {
     incident: Vec3::new(0.2, 1., -0.2),
     ambient_brightness: 0.8,
     distance: 2000,
};
let black = Material {
    color: Rgba([0, 0, 0, 255]),
    shininess: 7,
    reflection_brightness: 1.,
};
let blue = Material {
    color: Rgba([179, 220, 214, 255]),
    shininess: 4,
    reflection_brightness: 0.2,
};

let mut img = RgbaImage::new(300, 200);

let rim = RoundBox {
    top_left: point(50., 100.),
    bottom_right: point(250., 100.),
    border_radius: 40.,
    depth: -40.,
};
let trace = RoundBox {
    top_left: point(50., 100.),
    bottom_right: point(250., 100.),
    border_radius: 25.,
    depth: 25.,
};
vec![rim, trace].with(blue).draw(&setting, &mut img);

let slider_rim = RoundBox {
    top_left: point(50., 100.),
    bottom_right: point(150., 100.),
    border_radius: 20.,
    depth: -20.,
};
let slider_top = RoundBox {
    top_left: point(50., 100.),
    bottom_right: point(150., 100.),
    border_radius: 15.,
    depth: 5.,
};
let tips: Vec<_> = (-1..=1)
    .into_iter()
    .map(|i| RoundBox {
        top_left: point(100. + 12. * i as f64, 90.),
        bottom_right: point(100. + 12. * i as f64, 110.),
        border_radius: 4.,
        depth: -4.,
    })
    .collect();

vec![slider_rim, slider_top]
    .with(black.clone())
    .draw(&setting, &mut img);
tips.with(black).draw(&setting, &mut img);

dial

Show code
let setting = Setting {
    incident: Vec3::new(0.2, 1., -0.2),
    ambient_brightness: 0.8,
    distance: 2000,
};
let white = Material {
    color: Rgba([255, 255, 255, 255]),
    shininess: 7,
    reflection_brightness: 1.,
};
let black = Material {
    color: Rgba([0, 0, 0, 255]),
    shininess: 7,
    reflection_brightness: 1.,
};

let mut img = RgbaImage::new(300, 300);

let rim = Corn {
    center: point(150., 150.),
    radius: 150.,
    height: 450.,
};
let top = Concave {
    center: point(150., 150.),
    radius: 130.,
    depth: 30.,
};
let tip_rim = Corn {
    center: point(215., 85.),
    radius: 20.,
    height: -30.,
};
rim.with(white.clone()).draw(&setting, &mut img);
top.with(white.clone()).draw(&setting, &mut img);
tip_rim.with(white).draw(&setting, &mut img);

let tip = Concave {
    center: point(215., 85.),
    radius: 15.,
    depth: 2.5,
};
tip.with(black).draw(&setting, &mut img);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.