A simple text wrapping algorithm for multiline canvas text. Does not support hyphenation but will break words that don’t fit on a line by themselves.
A Pen by Peter Hrynkow on CodePen.
<div class="viewport"> | |
<div class="model"> | |
<ul class="axis"> | |
<li class="plane x"> | |
<div class="poly"></div> | |
<div class="poly"></div> | |
<div class="poly"></div> | |
<div class="poly"></div> | |
<span class="label unselectable left">Min</span> | |
<span class="label unselectable right">Max</span> |
<div class="viewport"> | |
<div class="model"> | |
<ul class="axis"> | |
<li class="plane x"> | |
<div class="poly"></div> | |
<div class="poly"></div> | |
<div class="poly"></div> | |
<div class="poly"></div> | |
<span class="label unselectable left">Min</span> | |
<span class="label unselectable right">Max</span> |
<div class="viewport"> | |
<div class="model"> | |
<ul class="axis"> | |
<li class="plane x"> | |
<div class="poly"></div> | |
<div class="poly"></div> | |
<div class="poly"></div> | |
<div class="poly"></div> | |
<span class="label unselectable left">Min</span> | |
<span class="label unselectable right">Max</span> |
<span id="curved">Here is some hot curved text. It goes all the way around.</span> | |
<span id="curved2">Here it is going the other way. What do you think?</span> |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<body> | |
<style> | |
circle { | |
stroke: #000; | |
fill-opacity: .1; | |
} |
A simple text wrapping algorithm for multiline canvas text. Does not support hyphenation but will break words that don’t fit on a line by themselves.
A Pen by Peter Hrynkow on CodePen.
// Peter Hrynkow | |
// Grid mixin | |
[class*=span-] { | |
float: left; | |
position: relative; | |
} | |
@mixin grid ($name, $columns, $padding-x, $padding-y) { | |
$column-width: 100% / $columns; | |
@for $i from 1 through $columns { | |
.span-#{$name}-#{$i} { |
I’m planning to create an SVG branch for CircleType.js – Here is a little experiement.
A Pen by Peter Hrynkow on CodePen.
$(document).ready(function () { | |
var p1 = $('.post-intro p').eq(0), | |
text = p1.text(); | |
p1.html('<span class="dropcap">' + text.substr(0,1) + '</span>' + text.substr(1)); | |
}); |
<svg preserveAspectRatio="xMinYMin" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" | |
viewBox="0 0 560 1388"> | |
<defs> | |
<mask id="canTopMask"> | |
<image width="560" height="1388" xlink:href="img/can-top-alpha.png"></image> | |
</mask> | |
</defs> | |
<image mask="url(#canTopMask)" id="canTop" width="560" height="1388" xlink:href="can-top.jpg"></image> | |
</svg> |