GithubHelp home page GithubHelp logo

emoacht / stripemaker Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 9.01 MB

A design tool to create the tile visuals for striped background

Home Page: https://www.microsoft.com/store/apps/9NV83VMN99TR

License: MIT License

C# 100.00%
stripe stripes tile xaml svg

stripemaker's Introduction

Stripe Maker

Stripe Maker is a design tool to create the tile visuals for striped background. It enables the user to try and see the elements of visuals for stripes with interactive live preview.

Screenshot
(Microsoft Store version)

Requirements

  • Windows 10 or newer
  • .NET Framework 4.8

Download

Microsoft Store version

Hash Pad

Standard version

๐Ÿ’พ Latest release

Usage

The visuals for stripes can be defined by 3 elements:

  • Offset from the origin (left-top corner) to cross line in the middle
  • Width of tile
  • Height of tile

You can adjust the offset (top slider), width (bottom slider) and height (left slider) to change the angle, thickness and distance of stripes. The change will be instantly reflected to preview area. In Microsoft Store version, you can change and swap colors, and change direction.

StripeMaker-usage.mp4

Once you get a satisfactory combination of elements, you can copy its path data usable for XAML and SVG. Let's say you want to fill an area of 300x240 with rotationally symmetric stripes and adjust elements as shown below.

Screenshot

The path data would be something like below.

M 0,0 L 65.88,79.76 L 65.88,36.55 L 35.69,0 z M 0,79.76 L 35.69,79.76 L 0,36.55 z

This is in Path Markup Syntax for XAML and it works for SVG as well.

For XAML

You can use this data for VisualBrush to fill the background of a window. Set this data to Data property of Path for VisualBrush's Visual property and make the width and height of VisualBrush's Viewport property to match those of this data.

<Window x:Class="WpfApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" SizeToContent="WidthAndHeight">
    <Grid Width="300" Height="240">
        <Grid.Background>
            <VisualBrush TileMode="Tile" Stretch="Fill"
                         Viewport="0,0,65.88,79.76" ViewportUnits="Absolute">
                <VisualBrush.Visual>
                    <Path Data="M 0,0 L 65.88,79.76 L 65.88,36.55 L 35.69,0 z M 0,79.76 L 35.69,79.76 L 0,36.55 z"
                          Fill="SkyBlue"/>
                </VisualBrush.Visual>
            </VisualBrush>
        </Grid.Background>
    </Grid>
</Window>

Then this window will look like as follows:

Screenshot

For SVG

You can use this data for pattern to fill rect.

<svg xmlns="http://www.w3.org/2000/svg">
  <defs>
    <pattern id="stripe"
             width="65.88" height="79.76" patternUnits="userSpaceOnUse">
      <path d="M 0,0 L 65.88,79.76 L 65.88,36.55 L 35.69,0 z M 0,79.76 L 35.69,79.76 L 0,36.55 z"
            fill="skyblue"/>
    </pattern>
  </defs>
  <rect width="100%" height="100%" fill="url(#stripe)"/>
</svg>

This SVG will produce the same background as shown above.

FYI, each pair of numbers delimited by a comma (In fact, it can be a space.) represents (x,y) coordinates and this data draws two simple shapes as described below.

Command Description
M 0,0 Start drawing a trapezoid from (0,0)
L 65.88,79.76 L 65.88,36.55 L 35.69,0 Draw line to (65.88,79.76), to (65.88,36.55), to (35.69,0)
z Close drawing
M 0,79.76 Start drawing a triangle from (0,79.76)
L 35.69,79.76 L 0,36.55 Draw line to (35.69,79.76), to (0,36.55)
z Close drawing

Additionally, in Microsoft Store version, you can save the tile image to a file in PNG format.

Histroy

v1.2 2023-1-8

  • Enable to change direction

v1.1 2022-3-27

  • Enable to directly change angle

v1.0 2022-2-20

  • Initial release

License

  • MIT License

Libraries

Developer

  • emoacht (emotom[atmark]pobox.com)

stripemaker's People

Contributors

emoacht avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.