I would like to draw an egg-format element, but I have only found ways of drawing ellipses.
14 Answers
Here is the only solution using the perfect (!) parametric equation of an egg (cf. Equation of Egg Shaped Curve) :
- x = H × 0.78 × cos(t × 0.25) × sin(t)
- y = H × cos(t)
(where H is the height of the egg and t is in [-π,π])
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\def\eggheight{3cm}
\path[ball color=orange!60!gray]
plot[domain=-pi:pi,samples=100]
({.78*\eggheight *cos(\x/4 r)*sin(\x r)},{-\eggheight*(cos(\x r))})
-- cycle;
\end{tikzpicture}
\end{document}
Edit: a second version with better colors.
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\def\eggheight{3cm}
\path[preaction={fill=orange!50!white},
ball color=orange!60!gray,fill opacity=.5]
plot[domain=-pi:pi,samples=100]
({.78*\eggheight *cos(\x/4 r)*sin(\x r)},{-\eggheight*(cos(\x r))})
-- cycle;
\end{tikzpicture}
\end{document}
-
8
-
2@ElAndi Actually, it's transcendental. But you can get puns from there too.– wcharginCommented Feb 17, 2014 at 15:36
The to[in=angle,out=angle]
and ball shading constructs are helpful for this:
Code
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[looseness=0.75,ball color=orange!70!gray] (-2,0) arc (180:360:2) to[out=90,in=0] (0,3) to[out=180,in=90] (-2,0) -- cycle;
\end{tikzpicture}
\end{document}
Result
Edit 1: I think this pudding is overegged.
Code
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[looseness=0.9,ball color=orange!70!gray!50,draw=none] (-2,0) arc (180:360:2) to[out=90,in=0] (0,3) to[out=180,in=90] (-2,0) -- cycle;
\end{tikzpicture}
\end{document}
Result
Edit 2: Following percusse's idea, I added a few freckles:
Code
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\colorlet{myEgg}{orange!70!gray!50}
\draw[looseness=0.9,ball color=orange!70!gray!50,draw=none,clip] (-2,0) arc (180:360:2) to[out=90,in=0] (0,3) to[out=180,in=90] (-2,0) -- cycle;
%\fill[blue] (-3,-3) rectangle (3,3);
\foreach \x in {1,...,100}
{ \pgfmathsetmacro{\rDot}{random()/50}
\pgfmathsetmacro{\xCoo}{rand*2}
\pgfmathsetmacro{\yCoo}{rand*2.5+0.5}
\pgfmathsetmacro{\dColor}{100-60*sqrt(pow(\xCoo+0.5,2)+pow(\yCoo-1.4,2))/2.6}
\fill[myEgg!\dColor!black] (\xCoo,\yCoo) circle (\rDot);
}
\end{tikzpicture}
\end{document}
Result
Edit 3: special request of ガベージコレクタ: here's 512 frog spawn (immersed in water):
Code
\documentclass[tikz,border=5mm]{standalone}
\usepackage{xifthen}
\usepackage{fp}
\newcommand{\frogegg}[2]%
{ \draw[ball color=black!80] (#1) circle (#2*0.25cm);
\draw[ball color=cyan!5!gray,opacity=0.1] (#1) circle (#2*1cm);
}
\pgfdeclarelayer{background layer}
\pgfsetlayers{background layer,main}
\begin{document}
\begin{tikzpicture}
[ x={(-27:1cm)},
y={(203:1cm)},
z={(95:1cm)},
]
\foreach \x in {0,...,7}
{ \foreach \y in {0,...,7}
{ \foreach \z in {0,...,7}
{ \pgfmathsetmacro{\xco}{\x+rand/3}
\pgfmathsetmacro{\yco}{\y+rand/3}
\pgfmathsetmacro{\zco}{\z+rand/3}
\pgfmathsetmacro{\rad}{1+rand/3}
\frogegg{\xco,\yco,\zco}{\rad}
}
}
}
\begin{pgfonlayer}{background layer}
\fill[blue!50!gray] (current bounding box.south west) rectangle (current bounding box.north east);
\end{pgfonlayer}
\end{tikzpicture}
\end{document}
Result
-
5It's a bit too "triangular"; compare to psdgraphics.com/file/brown-egg.jpg– egregCommented Sep 26, 2012 at 13:06
-
2Is this an organic egg?– user10274Commented Sep 26, 2012 at 15:58
-
3
-
8I can't tell the difference between the speckles on your egg and the ones on my monitor! Commented Sep 27, 2012 at 0:52
-
@QuinnCulver The speckles on your monitor are green.– user10274Commented Sep 27, 2012 at 4:13
A quick fix for egreg's egg. Thank you MATLAB for running so slow.
I've tried to find a dirt mask but couldn't find anything which would give a more realistic result. Also the shadow shading is a little off but the original render is also wrong.
\documentclass[tikz]{standalone}
\usetikzlibrary{shadings}
\definecolor{eggshell}{RGB}{252,230,201}
\pgfdeclareradialshading{eggshading}{\pgfpoint{1cm}{1cm}}%
{color(0cm)=(eggshell!80);
color(0.5cm)=(brown!75!eggshell);
color(0.7cm)=(brown);
color(0.9cm)=(brown!70!black);
color(1.2cm)=(black)
}
\pgfdeclareradialshading{eggshadow}{\pgfpointorigin}%
{color(0cm)=(black);
color(2mm)=(gray!80);
color(3mm)=(gray!40);
%color(0.3cm)=(black!5!white);
color(7mm)=(white)
}
\begin{document}
\begin{tikzpicture}
\begin{scope}[yscale=0.93,transform shape]
\node[xscale=2,yscale=0.3,shading=eggshadow,circle,minimum size=7mm] at (0,2.75mm){};
\shade[shading=eggshading] (0,2.7mm)..controls (9mm,0.25cm) and (7mm,2cm)%
..(0,20.5mm)..controls(-7mm,2cm) and (-9mm,2.5mm)..(0,2.7mm)--cycle;
\end{scope}
\node[anchor=south] at (2,0) {\includegraphics[height=2cm]{brownegg}};
\end{tikzpicture}
\end{document}
-
6I didn't look at the implementation but I think the egg to the right is the best of all eggs presented thus far.– user10274Commented Sep 26, 2012 at 20:04
-
2@MarcvanDongen Oh sorry to disappoint you that was the image that egreg linked to. I was merely trying to replicate on the left.– percusseCommented Sep 27, 2012 at 1:36
-
2@percusse Thanks, I see. Now that we know how to draw the egg, perhaps it's time for the question How to draw a bird laying an egg?– user10274Commented Sep 27, 2012 at 4:12
-
Great! But I'm wondering how the egg stands upright without cracked shell at the bottom? ;) Commented Sep 27, 2012 at 5:54
-
3@schmendrich It's boiled and spinning, hence it stays upright from the conservation of the angular momentum. :P– percusseCommented Sep 27, 2012 at 11:51
Since it is time... some Easter eggs:
The code:
\documentclass{article}
%\url{https://tex.stackexchange.com/a/74613/86}
\usepackage{tikz,charter}
\usetikzlibrary{hobby,
shapes.geometric,
decorations,
decorations.shapes,
shapes.geometric,
patterns
}
\makeatletter
\pgfdeclareradialshading[tikz@ball]{easter bg}{\pgfpoint{5bp}{25bp}}{%
color(0cm)=(tikz@ball!20);
color(0.15cm)=(tikz@ball!30);
color(0.4cm)=(tikz@ball!60);
color(0.9cm)=(tikz@ball)
}
\tikzoption{easter bg color}{\pgfutil@colorlet{tikz@ball}{#1}\def\tikz@shading{easter bg}\tikz@addmode{\tikz@mode@shadetrue}}
\pgfkeys{/tikz/easter star/.code args={#1 and #2}{
\pgfdeclareradialshading[tikz@ball]{easter star}{\pgfpoint{#1}{#2}}{%
color(0cm)=(tikz@ball!20);
color(0.3cm)=(tikz@ball!40);
color(0.65cm)=(tikz@ball!60);
color(1cm)=(tikz@ball)
}
}
\tikzoption{easter star color}{\pgfutil@colorlet{tikz@ball}{#1}\def\tikz@shading{easter star}\tikz@addmode{\tikz@mode@shadetrue}}
}
\makeatother
% original code by Paul Gaborit:
% tex.stackexchange.com/questions/72784/arrow-with-two-colors-with-tikz/#72793
\tikzset{
double path/.style args={#1 colored by #2 and #3}{
-,line join=round,line cap=rect,
shorten >=0.1cm,
shorten <=0.1cm,
line width=#1,#2, % first path
postaction={draw,-,#3,line width=(#1)/1.5,
shorten <=(#1)/3,shorten >=(#1)/3,
}, % second path
}
}
\tikzset{easter decoration 1/.style={
decorate,
decoration={
shape backgrounds,
shape=star,shape size=7pt,
shape sep={0.5cm, between center},
},
inner color=yellow,
outer color=yellow!50!orange,
draw=red!20!orange,
}
}
\pgfdeclarepatternformonly{fivepointed stars easter 2}{\pgfpointorigin}{\pgfpoint{10mm}{10mm}}{\pgfqpoint{10mm}{8mm}}%
{
\pgftransformshift{\pgfqpoint{1mm}{1mm}}
\pgfpathmoveto{\pgfqpointpolar{18}{1mm}}
\pgfpathlineto{\pgfqpointpolar{162}{1mm}}
\pgfpathlineto{\pgfqpointpolar{306}{1mm}}
\pgfpathlineto{\pgfqpointpolar{90}{1mm}}
\pgfpathlineto{\pgfqpointpolar{234}{1mm}}
\pgfpathclose%
\pgfusepath{fill}
}
\tikzset{easter decoration 3/.style={
draw=green!17!yellow,
line width=2pt,
star,
}
}
\pgfdeclarepatternformonly{fivepointed stars easter 3}{\pgfpointorigin}{\pgfpoint{12mm}{12mm}}{\pgfqpoint{12mm}{11mm}}%
{
\pgftransformshift{\pgfqpoint{1mm}{1mm}}
\pgfpathmoveto{\pgfqpointpolar{18}{1mm}}
\pgfpathlineto{\pgfqpointpolar{162}{1mm}}
\pgfpathlineto{\pgfqpointpolar{306}{1mm}}
\pgfpathlineto{\pgfqpointpolar{90}{1mm}}
\pgfpathlineto{\pgfqpointpolar{234}{1mm}}
\pgfpathclose%
\pgfusepath{fill}
}
% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
\begin{document}
% Easter Egg 1
\begin{tikzpicture}[use Hobby shortcut]
\node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Easter Egg 1};
% path clipping
\clip[scale=-6]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
% shading
\shade[easter bg color=orange,scale=-6]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
% colored paths
\draw[double path=5pt colored by orange!80!yellow and yellow,scale=-6] (0.775,0.35) .. (0.735,0.35) .. (0.65,0.3) .. (0.45,0.4) .. (0.235,0.355) .. (0.225,0.35);
\draw[double path=5pt colored by orange!80!yellow and yellow,scale=-6] (0.9,0.5) .. (0.775,0.55) .. (0.55,0.5) .. (0.45,0.6) .. (0.235,0.55) .. (0.1,0.5);
\draw[double path=5pt colored by orange!80!yellow and yellow,scale=-6] (0.9,0.7) .. (0.775,0.75) .. (0.55,0.7) .. (0.45,0.8) .. (0.235,0.75) .. (0.1,0.7);
% stars
\draw[easter decoration 1,scale=-6] (0.775,0.25) .. (0.735,0.25) .. (0.65,0.2) .. (0.45,0.3) .. (0.235,0.255) .. (0.225,0.25);
\draw[easter decoration 1,scale=-6] (0.9,0.4) .. (0.775,0.45) .. (0.55,0.4) .. (0.45,0.5) .. (0.235,0.45) .. (0.1,0.4);
\draw[easter decoration 1,scale=-6] (0.9,0.6) .. (0.775,0.65) .. (0.55,0.6) .. (0.45,0.7) .. (0.235,0.65) .. (0.1,0.6);
\draw[easter decoration 1,scale=-6] (0.9,0.8) .. (0.775,0.85) .. (0.55,0.8) .. (0.45,0.9) .. (0.235,0.85) .. (0.1,0.8);
% draw again the border
\draw[scale=-6]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
\end{tikzpicture}
% Easter Egg 2
\begin{tikzpicture}[use Hobby shortcut]
\node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Easter Egg 2};
% path clipping
\clip[scale=-6]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
% shading
\draw[easter bg color=blue!65!cyan,scale=-6,postaction={pattern=fivepointed stars easter 2,pattern color=blue}]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
\begin{scope}[transform canvas={shift={(-3.5,-3.5)}}]
\node[star,scale=2.25,easter star=2bp and 10bp, easter star color=cyan!65!blue] at (0.35,0.75){};
\node[star,scale=1.5,easter star=-2bp and 15bp, easter star color=cyan!85!blue,rotate=10] at (1.45,1.45){};
\node[star,scale=1.5,easter star=5bp and 10bp, easter star color=cyan!75!blue,rotate=-10] at (-0.5,1.95){};
\node[star,scale=1.65,easter star=5bp and 15bp, easter star color=cyan!45!blue,rotate=-5] at (-0.75,-0.85){};
\node[star,scale=1.7,easter star=5bp and 15bp, easter star color=cyan!37!blue,rotate=-3] at (0,-1.65){};
\node[star,scale=1.5,easter star=5bp and 10bp, easter star color=cyan!60!blue,rotate=2] at (0.85,-0.65){};
\node[star,scale=1.75,easter star=-2bp and 2bp, easter star color=cyan!60!blue,rotate=14] at (2,0){};
\end{scope}
% draw again the border
\draw[scale=-6]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
\end{tikzpicture}
% Easter Egg 3
\begin{tikzpicture}[use Hobby shortcut]
\node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Easter Egg 3};
% path clipping
\clip[scale=-6]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
% shading
\draw[easter bg color=green!77!blue,scale=-6,postaction={pattern=fivepointed stars easter 3,pattern color=green!20!yellow}]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
\begin{scope}[transform canvas={shift={(-3.5,-3.5)}}]
\node[easter decoration 3,scale=2.25] at (0.55,0.65){};
\node[easter decoration 3,scale=1.5,rotate=10] at (1.45,1.45){};
\node[easter decoration 3,scale=1.5,rotate=-10] at (-0.5,1.95){};
\node[easter decoration 3,scale=1.65,rotate=-5] at (-0.75,-0.70){};
\node[easter decoration 3,scale=1.7,rotate=-3] at (0,-1.65){};
\node[easter decoration 3,scale=1.5,rotate=2] at (0.85,-0.65){};
\node[easter decoration 3,scale=1.75,rotate=14] at (2,0){};
\end{scope}
% draw again the border
\draw[scale=-6]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
\end{tikzpicture}
\end{document}
I'm joining late the party unfortunately... I noticed that the OP didn't specified of which animal we should draw the egg, thus my answer.
\documentclass{article}
\usepackage{tikz,charter}
\usetikzlibrary{hobby,shapes.geometric,decorations,decorations.pathmorphing}
% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
% frigde egg (please don't consider my fridge as an animal :D )
\definecolor{eggl}{HTML}{F6AD7A}
\definecolor{eggli}{HTML}{E0996D}
\definecolor{egglii}{HTML}{D38C62}
\definecolor{eggliii}{HTML}{C37B53}
\definecolor{eggliiii}{HTML}{B56D45}
\definecolor{colfreckles}{HTML}{C78054}
\pgfdeclareradialshading{fridgeegg}{\pgfqpoint{5bp}{5bp}}{%
color(0bp)=(eggl);
color(11bp)=(eggli);
color(19bp)=(egglii);
color(25bp)=(eggliii);
color(50bp)=(eggliiii)}
% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
% duck egg
\definecolor{duckeggl}{HTML}{F4F3EF}
\definecolor{duckeggli}{HTML}{F1EDEA}
\definecolor{duckegglii}{HTML}{E2D5CD}
\definecolor{duckeggliii}{HTML}{AD9070}
\definecolor{duckeggliiii}{HTML}{7E5330}
% Important: no freckles visible
\pgfdeclareradialshading{duckegg}{\pgfqpoint{-11bp}{15bp}}{%
color(0bp)=(duckeggl);
color(8bp)=(duckeggli);
color(20bp)=(duckegglii);
color(37bp)=(duckeggliii);
color(50bp)=(duckeggliiii)}
% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
% quail egg
\definecolor{quaileggl}{HTML}{CAB8A2}
\definecolor{quaileggli}{HTML}{BFB399}
\definecolor{quailegglii}{HTML}{AE9B7D}
\definecolor{quaileggliii}{HTML}{90846C}
\definecolor{quaileggliiii}{HTML}{70644C}
\definecolor{quailcolfreckles}{HTML}{221F28}
\pgfdeclareradialshading{quailegg}{\pgfqpoint{11bp}{15bp}}{%
color(0bp)=(quaileggl);
color(10bp)=(quaileggli);
color(20bp)=(quailegglii);
color(30bp)=(quaileggliii);
color(50bp)=(quaileggliiii)}
% freckles
\definecolor{frecklesl}{HTML}{7B6140}
\definecolor{frecklesli}{HTML}{79767F}
\definecolor{freckleslii}{HTML}{5D5455}
\definecolor{frecklesliii}{HTML}{3C373E}
\definecolor{frecklesliiii}{HTML}{25242C}
\pgfdeclareradialshading{frecklesshading}{\pgfqpoint{4bp}{2bp}}{%
color(0bp)=(frecklesl);
color(2bp)=(frecklesli);
color(5bp)=(freckleslii);
color(10bp)=(frecklesliii);
color(15bp)=(frecklesliii)}
% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
\begin{document}
\begin{tikzpicture}[use Hobby shortcut]
% Fridge Egg
\node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Fridge Egg};
\shade[shading=fridgeegg,scale=-6]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
\foreach \i in {0,...,50}{
\pgfmathrandom{2,3}
\pgfmathsetmacro\myxshift{(\pgfmathresult*rnd)+2}
\pgfmathrandom{2,4.5}
\pgfmathsetmacro\myyshift{(\pgfmathresult*rnd)+1.5}
\draw[xshift=-\myxshift cm,yshift=-\myyshift cm,scale=0.3,colfreckles,fill=colfreckles] (0mm,0mm)--++(\pgfmathresult*0.1 mm,1mm)--++(\pgfmathresult*0.1 mm,\pgfmathresult*0.1 mm)--++(\pgfmathresult*0.1 mm,-\pgfmathresult*0.1 mm)--cycle;
}
\end{tikzpicture}
\begin{tikzpicture}[use Hobby shortcut]
% Duck Egg
\node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Duck Egg};
\shade[shading=duckegg,scale=-6]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
\end{tikzpicture}
$\quad$
\begin{tikzpicture}[use Hobby shortcut]
% Duck Egg
\node[above,xshift=-2cm,yshift=1.5cm] at (0.5,1){Quail Egg};
\shade[shading=quailegg,scale=-3]([closed=true]0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1);
\foreach \i in {0,...,45}{
\pgfmathrandom{1.90,1.975}
\pgfmathsetmacro\myxshift{(\pgfmathresult*rnd)+1.05}
\pgfmathrandom{2.90,2.98}
\pgfmathsetmacro\myyshift{(\pgfmathresult*rnd)+0.725}
\pgfmathrnd
\draw[xshift=-\myxshift cm,yshift=-\myyshift cm,scale=0.2,quailcolfreckles,fill=quailcolfreckles] (0mm,0mm)--++(\pgfmathresult*0.1 mm,1mm)--++(\pgfmathresult*0.1 mm,\pgfmathresult*0.1 mm)--++(\pgfmathresult*0.1 mm,-\pgfmathresult*0.1 mm)--cycle;
}
% further freckles
\node[draw=none,rounded corners, thick,ellipse,shading=frecklesshading,
xshift=-2cm,yshift=-1cm,
decorate,decoration={random steps,segment length=3mm,amplitude=1mm}] {};
\node[draw=none,rounded corners, thick,ellipse,shading=frecklesshading,
xshift=-1.3cm,yshift=-1.5cm,
decorate,decoration={random steps,segment length=5mm,amplitude=4mm}] {};
\node[draw=none,rounded corners, thick,ellipse,shading=frecklesshading,
xshift=-1.6cm,yshift=-2.5cm,
decorate,decoration={bent}] {};
\node[draw=none,rounded corners, thick,ellipse,shading=frecklesshading,
xshift=-1.9cm,yshift=-2cm,
decorate,decoration={bent}] {};
\end{tikzpicture}
\end{document}
Just for fun (hope Paulo doesn't mind):
\documentclass{beamer}
\renewcommand*\sfdefault{augie}
\renewcommand*\familydefault{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage{tikz,etoolbox}
\input{pc-duck}
\usetikzlibrary{hobby,decorations,decorations.pathmorphing}
\begin{document}
\begin{frame}{True Story}
\begin{tikzpicture}[use Hobby shortcut]
\foreach \step in {1,...,8}{
\pgfmathtruncatemacro\currstep\step
\ifnumodd{\currstep}{%true
\draw<\currstep>[scale=-5,inner color=white,outer color=gray!5,rotate=-10] ([closed=true]0.5,0.1) .. (0.7,0.28) .. (0.5,1) .. (0.3,0.28) .. (0.5,0.1);
}{%false
\draw<\currstep>[scale=-5,inner color=white,outer color=gray!5,rotate=10] ([closed=true]0.5,0.1) .. (0.7,0.28) .. (0.5,1) .. (0.3,0.28) .. (0.5,0.1);
}
}
\foreach \step in {4,...,8}{
\pgfmathtruncatemacro\currstep\step
\pgfmathsetmacro\adv{0.175*\step}
\ifnumodd{\currstep}{%true
\draw<\currstep>[xshift=-4cm,yshift=-1.5cm,rotate=-15]decorate[decoration=zigzag] {(0,0) -- (\adv,0)};
}{%false
\draw<\currstep>[xshift=-3.3cm,yshift=-3cm,rotate=15]decorate[decoration=zigzag] {(0,0) -- (\adv,0)};
}
}
\draw<9>[scale=-5,inner color=white,outer color=gray!5] ([closed=true]0.5,0.1) .. (0.7,0.28) .. (0.5,1) .. (0.3,0.28) .. (0.5,0.1);
\draw<9>[xshift=-3.7cm,yshift=-2.2cm]decorate[decoration=zigzag] {(0,0) -- (1.9,0)};
\end{tikzpicture}
\visible<10>{\drawduck}
\end{frame}
\end{document}
-
5
-
4
-
1
-
A reference to find the
hobby
package: Where in the world is tikzlibraryhobby.code.tex? Commented Dec 10, 2012 at 13:28 -
Too bad, Claudio, that you did not publish the easter egges separately. So I cannot upvote a second time.– SperavirCommented Mar 29, 2013 at 19:16
A broken egg with PSTricks.
\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\begin{pspicture}(4.5,4.5)
\pscircle*[linecolor=orange](2,2){1}
\psccurve(0.5,0.5)(0.25,2)(1,3)(2,4)(4,4)(4.5,3)(4,1)(0.8,0.2)(0.5,0.5)
\end{pspicture}
\end{document}
Animated version:
on the frying pan...
\documentclass[pstricks]{standalone}
\usepackage{pst-node,pst-plot}
\begin{document}
\pstVerb{realtime srand}%
\psLoop{25}{%
\begin{pspicture}(-2,-2)(2,2)
\pscircle*[linecolor=orange]{0.75}
\curvepnodes[plotpoints=73]{0}{360}{rand 101 mod 1000 div 1.50 add t PtoC}{P}
\def\points{}%
\multido{\i=0+1}{\Pnodecount}{\xdef\points{\points (P\i)}}
\expandafter\psccurve\points
\end{pspicture}}
\end{document}
-
1It's only the inside of a broken egg. Where's the shell? Commented Sep 26, 2012 at 13:09
-
2Next on the list: amlet!– user11232Commented Sep 26, 2012 at 15:06
-
6
-
2I think ガベージコレクタ needs to have another
ー
on the end: ガベージコレクター. That's the usual pattern anyway.– LarsHCommented Sep 26, 2012 at 17:52 -
3@ガベージコレクタ: Ay lad, that's the daily reputation limit. As I see it you're at 24 upvotes, of which only 20 are counted. Commented Sep 26, 2012 at 21:37
With PGFPlots:
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\begin{document}
%
\begin{tikzpicture}
\begin{axis}[
hide axis, clip=false,
y domain=0:2*pi,
samples=30,axis equal, view={45}{20}]
\addplot3 [domain=-1:1,surf,z buffer=sort,shader=flat,fill=brown!80!yellow, draw=black!20!brown, join=round]
({sqrt(1-x^2)*cos(deg(y))},
{sqrt(1-x^2)*sin(deg(y))},
{sqrt(x+2.2)*x});
\end{axis}
\end{tikzpicture}%
%
\end{document}
-
4
hobby
time:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}[use Hobby shortcut]
\draw[scale=-1,inner color=white,outer color=gray!5] ([closed=true]0.5,0.1) .. (0.7,0.28) .. (0.5,1) .. (0.3,0.28) .. (0.5,0.1);
\end{tikzpicture}
\end{document}
Adding some color:
\PassOptionsToPackage{svgnames}{xcolor}
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}[use Hobby shortcut]
\draw[draw=none,scale=-3,ball color=orange!50!gray,] ([closed=true]0.5,0.1) .. (0.7,0.28) .. (0.5,1) .. (0.3,0.28) .. (0.5,0.1);
\end{tikzpicture}
\end{document}
Somebody spun this egg and it is spinning due to the inertia of inside fluids (a fresh egg ;-) indeed):
-
-
-
Note that the
.. cycle
syntax no longer works withhobby
. See tex.stackexchange.com/a/121310/86 for more details (and how to fix it). Commented Jul 9, 2013 at 8:00
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}[use Hobby shortcut]
\draw ([closed=true]0,0) .. (1,3) .. ([tension=1.4]0,4) .. (-1,3);
\end{tikzpicture}
\end{document}
Update To show-off the hobby
a little more, here's a second version. I took the egg that egreg linked to and found some points on its boundary then used those as the inputs to the Hobby algorithm. The left-hand egg is the original egg with the control points shown in red and the path shown in black. The right-hand egg is the same path shifted over and then filled with the same fill as in Tom Bombadill's answer (sans freckles).
Code:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}[use Hobby shortcut]
\node[anchor=south west,inner sep=0] (image) at (0,0)
{\includegraphics[width=.9\textwidth]{brown-egg.jpg}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\useasboundingbox (-.1,-.1) rectangle (2.1,1.1);
\fill[red,c/.style={insert path={circle[radius=5pt]}}]
(0.5,0) [c] coordinate (a)
(.965,.3) [c] coordinate (b)
(.865,.8) [c] coordinate (bb)
(0.5,.998) [c] coordinate (c)
(.135,.8) [c] coordinate (dd)
(.04,.3) [c] coordinate (d);
\draw[ultra thick,postaction={transform canvas={shift={(1,0)}},ball
color=orange!70!gray}] ([closed=true]a) .. (b) .. (bb) .. (c) .. (dd) .. (d);
\end{scope}
\end{tikzpicture}
\end{document}
(The image is the egg picture cropped to the egg.)
Result:
-
4
-
4@egreg My excuse is that I was using a development version and my egg had a bug in it which I had to squash first before posting (wouldn't do to have eggs with bugs in them, now, would it?). Commented Sep 26, 2012 at 13:22
-
The
.. cycle
syntax no longer works withhobby
. See tex.stackexchange.com/a/121310/86 for more details and how to fix it. Commented Jul 9, 2013 at 8:00
Did you mean something like this:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0)
.. controls (0,-1.5) and (2,-1.5).. (2,0)
.. controls (2,2.5) and (0,2.5) .. (0,0);
\end{tikzpicture}
\end{document}
Maybe the exact shape needs some tweaking but the way to go should be clear.
Sorry for be late to this egg party, but I think that is interesting to show you another way to draw an egg celebrating this New Year!
In order to reproduce the egg, I only draw a special closed polygonal that looks like a smooth curve: a "subdivision curve". A subdivision scheme is an iterative way to obtain curves or surfaces by mean of refinements of polygons or meshes in the respective cases. If you wish that the final polygonal (obtained in the last iteration) looks more smooth, you should consider make another iteration (e.g, a fourth iteration in this case). For this sketch, the subdivision scheme that I choose was the one to get a cubic B-Spline and only made 3 iterations. (By the way, thanks to everyone who help me in my question Using \foreach loop in Cubic B-spline curve refinement).
This is my code (feel free to improve it):
\documentclass[margin={1.5cm 0pt}]{standalone}
\usepackage{pgf,tikz}
\newcommand{\sscubicBS}[1]{
\def\count{#1}
\pgfmathtruncatemacro{\lasti}{\count+1}
\pgfmathtruncatemacro{\lastii}{\count+2}
\coordinate (p\lasti) at (p1);
\coordinate (p\lastii) at (p2);
\coordinate (p0) at (p\count);
\foreach \i in {1,...,\count} {%
\pgfmathtruncatemacro{\j}{\i+1}%
\pgfmathtruncatemacro{\k}{\i+2}%
\pgfmathtruncatemacro{\even}{2*\i-1}%
\pgfmathtruncatemacro{\odd}{2*\i}%
\coordinate (n\even) at (barycentric cs:p\i=0.5,p\j=0.5);
\coordinate (n\odd) at (barycentric cs:p\i=0.125,p\j=0.75,p\k=0.125);
}
\pgfmathtruncatemacro{\count}{2*\count}
\foreach \i in {1,...,\count} {
\coordinate (p\i) at (n\i);
}
}
\begin{document}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0)
{\includegraphics[width=.5\textwidth]{brown-egg.jpg}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\useasboundingbox (-.1,-.1) rectangle (2.1,1.1);
\fill[blue,c/.style={insert path={circle[radius=5pt]}}] %control points
(0.31,-.01) [c] coordinate (p1)
(0.69,-.01) [c] coordinate (p2)
(1.01,.25) [c] coordinate (p3)
(1.01,.68) [c] coordinate (p4)
(0.69,1.01) [c] coordinate (p5)
(0.31,1.01) [c] coordinate (p6)
(-.01,.68) [c] coordinate (p7)
(-.01,.25) [c] coordinate (p8);
\def\count{8}
% control polygon
\draw[line width=1pt,blue] (p1) \foreach \p in {2,...,\count} {-- (p\p)} -- cycle;
\sscubicBS{8} % first iteration
\sscubicBS{16} % second iteration
\sscubicBS{32} % third iteration
% \sscubicBS{64} % fourth iteration
\draw[line width=1pt,black,postaction={transform canvas={shift={(1.3,0)}},draw=red}] (p1) \foreach \i in {2,...,\count}{-- (p\i)} -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}
As @AndrewStacey, I took the egg that @egreg provided (left egg) and created a (symmetric) control polygon (blue points and blue polygon) as the inputs to the subdivision scheme that generates the egg in right side (the same as the black boundary in the egreg's egg). If you create a mesh as mesh of revolution of this control polygon and use it as input of the Catmull-Clark subdivision scheme for surface you will get the egg in 3D!
I didn't add any color to my egg, but feel free to add the color and shading that you wish ;-)
So many good answers, but I think I can offer yet another duck egg:
\documentclass[border=2mm]{standalone}
\usepackage {tikz}
\usetikzlibrary{calc,ducks}
\begin{document}
\begin{tikzpicture}
% background
\fill[ball color=gray!35] ($(1,0)+(160:2)$) -- (-0.6,1) -- (-0.1,0.7) -- (0.4,0.9) --
($(-1,0)+(20:2)$) --++ (0,-1) --++ (-1.5,0) -- cycle;
% duck
\duck[crazyhair=blue,scale=0.8,xshift=-1cm,yshift=-0.3cm];
% egg
\fill[ball color=orange!55] ($(1,0)+(160:2)$) arc (160:180:2) arc (180:360:1) arc (0:20:2) --
(0.5,1.1) -- (0.3,0.5) -- (-0.1,0.8) -- (-0.5,0.3) -- cycle;
\end{tikzpicture}
\end{document}
-
3
Following this video on how to draw an egg shape with geometry, one can draw egg using four arcs.
MWE
The coordinates used are also marked in the figure.
\documentclass[border=3mm]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[scale=2]
\def\la{2}
\tkzDefPoint(0,0){O}
\tkzDefPoint(-\la,0){A}
\tkzDefPoint(\la,0){B}
\tkzDefPoint(0,\la){C}
\tkzDefShiftPoint[A](45:2*\la){E}
\tkzDefShiftPoint[B](135:2*\la){D}
\tkzDrawArc[thick](O,A)(B) % arc1 - AB
\tkzDrawArc[thick](A,B)(E) % arc2 - BE
\tkzDrawArc[thick](B,D)(A) % arc3 - DA
\tkzDrawArc[thick](C,E)(D) % arc4 - ED
\tkzDrawPoints(O,A,B,C,D,E)
\tkzLabelPoints[below](O,A,B,C,D,E)
\end{tikzpicture}
\end{document}
Two eggs in the basket drawn with Mathcha.
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}
% Gradient Info
\tikzset {_mb7lt80xg/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{89.1 bp } { -128.7 bp } } \pgftransformscale{1.32 } }}}
\pgfdeclareradialshading{_4sdvzxa49}{\pgfpoint{-72bp}{104bp}}{rgb(0bp)=(1,1,1);
rgb(0bp)=(1,1,1);
rgb(17.05357142857143bp)=(0.9,0.62,0.16);
rgb(24.107142857142858bp)=(1,1,1);
rgb(400bp)=(1,1,1)}
% Gradient Info
\tikzset {_0ezr9j4zj/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{89.1 bp } { -128.7 bp } } \pgftransformscale{1.32 } }}}
\pgfdeclareradialshading{_1z3dyg6xi}{\pgfpoint{-72bp}{104bp}}{rgb(0bp)=(1,1,1);
rgb(0bp)=(1,1,1);
rgb(17.05357142857143bp)=(0.9,0.62,0.16);
rgb(24.107142857142858bp)=(1,1,1);
rgb(400bp)=(1,1,1)}
% Pattern Info
\tikzset{
pattern size/.store in=\mcSize,
pattern size = 5pt,
pattern thickness/.store in=\mcThickness,
pattern thickness = 0.3pt,
pattern radius/.store in=\mcRadius,
pattern radius = 1pt}
\makeatletter
\pgfutil@ifundefined{pgf@pattern@name@_zoyi1qxct}{
\pgfdeclarepatternformonly[\mcThickness,\mcSize]{_zoyi1qxct}
{\pgfqpoint{0pt}{0pt}}
{\pgfpoint{\mcSize}{\mcSize}}
{\pgfpoint{\mcSize}{\mcSize}}
{
\pgfsetcolor{\tikz@pattern@color}
\pgfsetlinewidth{\mcThickness}
\pgfpathmoveto{\pgfqpoint{0pt}{\mcSize}}
\pgfpathlineto{\pgfpoint{\mcSize+\mcThickness}{-\mcThickness}}
\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
\pgfpathlineto{\pgfpoint{\mcSize+\mcThickness}{\mcSize+\mcThickness}}
\pgfusepath{stroke}
}}
\makeatother
\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,300); %set diagram left start at 0, and has height of 300
%Shape: Ellipse [id:dp5284058265401532]
\draw [draw opacity=0][shading=_4sdvzxa49,_mb7lt80xg] (272.72,171.25) .. controls (252.85,153.47) and (255.43,118.18) .. (278.47,92.44) .. controls (301.52,66.71) and (336.31,60.26) .. (356.17,78.05) .. controls (376.04,95.84) and (373.46,131.12) .. (350.42,156.86) .. controls (327.37,182.6) and (292.59,189.04) .. (272.72,171.25) -- cycle ;
%Shape: Ellipse [id:dp4745874887731858]
\draw [draw opacity=0][shading=_1z3dyg6xi,_0ezr9j4zj] (120.41,124.73) .. controls (120.19,95.39) and (150.82,71.38) .. (188.83,71.09) .. controls (226.83,70.81) and (257.82,94.36) .. (258.04,123.69) .. controls (258.26,153.03) and (227.63,177.04) .. (189.62,177.33) .. controls (151.62,177.61) and (120.63,154.06) .. (120.41,124.73) -- cycle ;
%Shape: Pie [id:dp44419191458101737]
\draw [color={rgb, 255:red, 139; green, 87; blue, 42 } ,draw opacity=1 ][pattern=_zoyi1qxct,pattern size=6pt,pattern thickness=0.75pt,pattern radius=0pt, pattern color={rgb, 255:red, 139; green, 87; blue, 42}][line width=1.5] (372.34,101.55) .. controls (373.43,105.93) and (374,110.42) .. (374,115) .. controls (374,161.39) and (315.57,199) .. (243.5,199) .. controls (171.43,199) and (113,161.39) .. (113,115) .. controls (113,110.6) and (113.53,106.28) .. (114.54,102.06) -- (243.5,115) -- cycle ;
\end{tikzpicture}
\end{document}
...and a bright egg...
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\begin{document}
% Gradient Info
\tikzset {_bs97t7kyb/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{89.1 bp } { -128.7 bp } } \pgftransformscale{1.32 } }}}
\pgfdeclareradialshading{_zqy0j80xw}{\pgfpoint{-72bp}{104bp}}{rgb(0bp)=(1,1,1);
rgb(0bp)=(1,1,1);
rgb(17.05357142857143bp)=(0.9,0.62,0.16);
rgb(24.107142857142858bp)=(1,1,1);
rgb(400bp)=(1,1,1)}
\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,300); %set diagram left start at 0, and has height of 300
%Shape: Ellipse [id:dp4745874887731858]
\draw [draw opacity=0][shading=_zqy0j80xw,_bs97t7kyb] (205.96,249.14) .. controls (164.17,247.15) and (132.52,198.53) .. (135.27,140.54) .. controls (138.03,82.55) and (174.14,37.15) .. (215.94,39.14) .. controls (257.74,41.13) and (289.39,89.74) .. (286.63,147.73) .. controls (283.88,205.72) and (247.76,251.12) .. (205.96,249.14) -- cycle ;
\end{tikzpicture}
\end{document}
one unburnt fried egg....
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{shadows}
\begin{document}
\tikzset {_3eubqr20l/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{0 bp } { 0 bp } } \pgftransformrotate{0 } \pgftransformscale{2.64 } }}}
\pgfdeclarehorizontalshading{_y5uoy9rpz}{150bp}{rgb(0bp)=(0.99,0.97,0.93);
rgb(54.285714285714285bp)=(0.99,0.97,0.93);
rgb(61.96428571428571bp)=(0.98,0.95,0.95);
rgb(100bp)=(0.98,0.95,0.95)}
\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,300); %set diagram left start at 0, and has height of 300
%Shape: Polygon Curved [id:ds24835565753561872]
\draw [draw opacity=0][shading=_y5uoy9rpz,_3eubqr20l] (228.87,88.88) .. controls (266.87,64.88) and (266.87,111.88) .. (282.87,123.88) .. controls (298.87,135.88) and (360.87,96.88) .. (335.87,141.88) .. controls (310.87,186.88) and (389.87,249.88) .. (305.87,226.88) .. controls (221.87,203.88) and (251.87,247.88) .. (208.87,236.88) .. controls (165.87,225.88) and (201.87,193.88) .. (183.87,172.88) .. controls (165.87,151.88) and (157.87,118.88) .. (191.87,123.88) .. controls (225.87,128.88) and (190.87,112.88) .. (228.87,88.88) -- cycle ;
%Shape: Circle [id:dp2977666721327956]
\draw [draw opacity=0][fill={rgb, 255:red, 253; green, 170; blue, 30 } ,fill opacity=0.89 ][general shadow={fill={rgb, 255:red, 245; green, 166; blue, 35 } ,shadow xshift=3pt,shadow yshift=0pt, opacity=1 }] (238,165.5) .. controls (238,147) and (253,132) .. (271.5,132) .. controls (290,132) and (305,147) .. (305,165.5) .. controls (305,184) and (290,199) .. (271.5,199) .. controls (253,199) and (238,184) .. (238,165.5) -- cycle ;
%Shape: Ellipse [id:dp5805520465941827]
\draw [draw opacity=0][fill={rgb, 255:red, 233; green, 152; blue, 19 } ,fill opacity=1 ] (265.43,186.22) .. controls (261.59,181.1) and (265.3,171.81) .. (273.73,165.48) .. controls (282.16,159.14) and (292.12,158.15) .. (295.97,163.27) .. controls (299.81,168.39) and (296.1,177.67) .. (287.67,184.01) .. controls (279.23,190.35) and (269.28,191.34) .. (265.43,186.22) -- cycle ;
%Shape: Block Arc [id:dp4643699266244976]
\draw [draw opacity=0][fill={rgb, 255:red, 255; green, 255; blue, 255 } ,fill opacity=1 ] (181.64,151.16) .. controls (181.68,147.43) and (182.42,143.85) .. (183.93,140.65) .. controls (186.88,134.44) and (192.19,130.86) .. (198.43,130.09) -- (201.36,139.03) .. controls (196.68,139.19) and (192.72,141.5) .. (190.65,145.86) .. controls (189.57,148.15) and (189.12,150.76) .. (189.23,153.51) -- cycle ;
%Shape: Block Arc [id:dp28641962733560566]
\draw [draw opacity=0][fill={rgb, 255:red, 255; green, 255; blue, 255 } ,fill opacity=1 ] (209.55,189.06) .. controls (207.11,187.92) and (204.68,186.55) .. (202.32,184.94) .. controls (197.19,181.46) and (192.99,177.29) .. (189.87,172.88) -- (197.79,170.62) .. controls (200.18,173.44) and (203.18,176.15) .. (206.68,178.53) .. controls (208.26,179.61) and (209.87,180.57) .. (211.49,181.4) -- cycle ;
\end{tikzpicture}
\end{document}
-
1I really expect an answer from you (can you believe?? ha ha ha) ... and finally you came....– MadyYuviCommented May 22, 2021 at 5:19
-
@MadyYuvi Very very kind friend ahahahahh... I believe to you :-)))))....and like a wizard I'm here :-))) Commented May 22, 2021 at 19:18
\draw[scale=3] (0.5,0.1) to [out=0,in=-90] (0.8,0.42) to [out=90,in=0, in looseness=0.7] (0.5,0.92) to [out=180, in=90, out looseness=0.7] (0.2,0.42) to [out=-90, in=180] (0.5,0.1);